from django.conf.urls.defaults import *

from blog.apps.blog.models import Entry

entry_info = {
    'queryset': Entry.objects.all(),
    'date_field': 'pub_date',
}

entry_detail_info = {
    'queryset': Entry.objects.all(),
    'date_field': 'pub_date',
    'slug_field': 'slug'
}

urlpatterns = patterns('django.views.generic.date_based',
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        'object_detail', entry_detail_info),
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/$', 'archive_day', 
        entry_info),
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', entry_info),
    (r'^(?P<year>\d{4})/$', 'archive_year', entry_info),
    (r'^/?$', 'archive_index', entry_info),
)


from django.contrib.sitemaps import GenericSitemap
from bingo.apps.blog.urls.entries import entry_info

entries_sitemaps = {
    'blog': GenericSitemap(entry_info, changefreq="never"),
}

urlpatterns += patterns('django.contrib.sitemaps.views',
    (r'^sitemap.xml$', 'sitemap', {'sitemaps': entries_sitemaps})
)


from bingo.apps.blog.feeds import *

entries_feeds = {
    'atom': AtomLatestEntriesFeeds,
    'rss': RssLatestEntriesFeeds,
}

urlpatterns = patterns('django.contrib.syndication.views',
    (r'^feeds/(?P<url>.*)/$', 'feed', {'feed_dict': entries_feeds}),
)
